function Ajax() {
}
Ajax.prototype.doAjax = function(url ,  data , fCallBack ) {
	$.ajax({
			type:"post",
			url : url,
			dataType : "text",
			data:data,
			cache:false,
			beforeSend : function(){
				doAjaxMessage();
		},success : function(text){
			removeAjaxMessage();
			try{
				eval(""+fCallBack+"('"+text+"')");}
			catch(e){
				doBackfun(text);
			}
		},error : function() {
			removeAjaxMessage();
			$.messager.alert("错误","操作失败,请稍后再试","error");
			}
		});
};
function addOption(option,element){
	for (key in option) {
		$('#'+element).append("<option value=" + key + ">" +option[key] + "</option>");
	}
}
function addOptions(option,element){
	for (key in option) {
		if(option[key]['CODE']==undefined) continue;
		$('#'+element).append("<option  value=" + option[key]['CODE'] + ">" +option[key]['NAME'] + "</option>");
	}
}

function getJsonText(list,value){
	value = value-0;
	for (key in list) {
		if(key==value){
			return list[key];
		}
	}
}
Ajax.prototype.stringify = function(obj) {
    var t = typeof (obj);     if (t != "object" || obj === null) {                if (t == "string") obj = '"'+obj+'"';         return String(obj);     }     else {         var n, v, json = [], arr = (obj && obj.constructor == Array);         for (n in obj) {             v = obj[n]; t = typeof(v);             if (t == "string") v = '"'+v+'"';             else if (t == "object" && v !== null) v = JSON.stringify(v);             json.push((arr ? "" : '"' + n + '":') + String(v));         }         return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");     } };

Ajax.prototype.showMess = function (msg){
	$.messager.show({
       title: '提示',
       msg: msg,
       timeout: 5000,
       showType: 'slide'
   });
} 
